﻿@model Apps.Models.Sys.SysSampleModel
@using Apps.Common;
@using Apps.Models.Sys;
@using Apps.Web.Core;
@using Apps.Locale;
@{
    ViewBag.Title = "修改";
    Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
    List<permModel> perm = null;
}

<script type="text/javascript">
    $(function () {
        $("#btnSave").click(function () {
            if ($("form").valid()) {
                $.ajax({
                    url: "@Url.Action("Edit")",
                    type: "Post",
                    data: $("form").serialize(),
                    dataType: "json",
                    success: function (data) {
                        if (data.type == 1) {
                            window.parent.frameReturnByMes(data.message);
                            window.parent.frameReturnByReload(true);
                            window.parent.frameReturnByClose()
                        }
                        else {
                            window.parent.frameReturnByMes(data.message);
                        }
                    }
                });
            }
            return false;
        });
        $("#btnReturn").click(function () {
            window.parent.frameReturnByClose();
        });
    });
</script>
<div class="mvctool bgb">
    @Html.ToolButton("btnSave", "fa fa-save", Resource.Save, ref perm, "Save", true)
    @Html.ToolButton("btnReturn", "fa fa-reply", Resource.Reply, false)
</div>
@using (Html.BeginForm())
{
    @Html.HiddenFor(model => model.Id)
    @Html.HiddenFor(model => model.CreateTime)
    <table class="formtable">
        <tbody>
            <tr>
                <th>
                    @Html.LabelFor(model => model.Name)：
                </th>
                <td>
                    @Html.EditorFor(model => model.Name)
                    @Html.ValidationMessageFor(model => model.Name)
                </td>
            </tr>
            <tr @(BaseController.ShowFieldPerm(perm,"Age"))>
                <th>
                    @Html.LabelFor(model => model.Age)：
                </th>
                <td>
                    @Html.EditorFor(model => model.Age)
                    @Html.ValidationMessageFor(model => model.Age)
                </td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.Bir)：
                </th>
                <td>
                    @Html.TextBoxFor(model => model.Bir, new {  @onClick = "WdatePicker()",@class= "Wdate", Value = String.Format("{0:yyyy-MM-dd}", Model.Bir), @style = "width:105px" })
                    @Html.ValidationMessageFor(model => model.Bir)
                </td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.Photo)：
                </th>
                <td>
                    @Html.HiddenFor(model => model.Photo)
                    <img class="expic" src="@((Model.Photo==null||Model.Photo=="")?"/Content/Images/NotPic.jpg":Model.Photo)" /><br />
                    <a href="javascript:$('#FileUpload').trigger('click');" class="files">@Resource.Browse</a>
                    <input type="file" class="displaynone" id="FileUpload" name="FileUpload" onchange="Upload('SingleFile', 'Photo', 'FileUpload','1','1');" />
                    <span class="uploading">@Resource.Uploading</span>
                    @Html.ValidationMessageFor(model => model.Photo)
                </td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.Note)：
                </th>
                <td>
                    @Html.EditorFor(model => model.Note)
                    @Html.ValidationMessageFor(model => model.Note)
                </td>
            </tr>

        </tbody>
    </table>
}
